package com.spatio.serving.basic.service.template.core;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClients;

import java.io.IOException;
import org.json.JSONObject;
public class test {

    public static void main(String[] args) throws IOException {




                String jsonString = "data:{\"event\":\"message\",\"message\":{\"role\":\"assistant\",\"type\":\"answer\",\"content\":\"亲\",\"content_type\":\"text\"},\"is_finish\":false,\"index\":0,\"conversation_id\":\"123\",\"seq_id\":0}";

                // 移除 "data:" 前缀
                jsonString = jsonString.substring(5);

                // 解析 JSON 字符串
                JSONObject jsonObject = new JSONObject(jsonString);

                // 提取 "content" 字段的值
                String content = jsonObject.getJSONObject("message").getString("content");

                System.out.println("提取出的内容: " + content);
            }
        }



